/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.tratamiento.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.isn.atencionemergencia.entity.DetalleResultadooaeVacuna;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "vacuna")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Vacuna.findAll", query = "SELECT v FROM Vacuna v"),
    @NamedQuery(name = "Vacuna.findByCodVacuna", query = "SELECT v FROM Vacuna v WHERE v.codVacuna = :codVacuna"),
    @NamedQuery(name = "Vacuna.findByDescVacuna", query = "SELECT v FROM Vacuna v WHERE v.descVacuna = :descVacuna")})
public class Vacuna implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Vacuna", columnDefinition="CHAR(5) unsigned")
    private String codVacuna;
    @Column(name = "Desc_Vacuna")
    private String descVacuna;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "vacuna")
    private Collection<DetalleResultadooaeVacuna> detalleResultadooaeVacunaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "vacuna")
    private Collection<AplicacionVacuna> aplicacionVacunaCollection;
    @JoinColumn(name = "Cod_Tipo_vacu", referencedColumnName = "Cod_Tip_Vacu")
    @ManyToOne(optional = false)
    private TipoVacuna codTipovacu;

    public Vacuna() {
    }

    public Vacuna(String codVacuna) {
        this.codVacuna = codVacuna;
    }

    public String getCodVacuna() {
        return codVacuna;
    }

    public void setCodVacuna(String codVacuna) {
        this.codVacuna = codVacuna;
    }

    public String getDescVacuna() {
        return descVacuna;
    }

    public void setDescVacuna(String descVacuna) {
        this.descVacuna = descVacuna;
    }

    @XmlTransient
    public Collection<DetalleResultadooaeVacuna> getDetalleResultadooaeVacunaCollection() {
        return detalleResultadooaeVacunaCollection;
    }

    public void setDetalleResultadooaeVacunaCollection(Collection<DetalleResultadooaeVacuna> detalleResultadooaeVacunaCollection) {
        this.detalleResultadooaeVacunaCollection = detalleResultadooaeVacunaCollection;
    }

    @XmlTransient
    public Collection<AplicacionVacuna> getAplicacionVacunaCollection() {
        return aplicacionVacunaCollection;
    }

    public void setAplicacionVacunaCollection(Collection<AplicacionVacuna> aplicacionVacunaCollection) {
        this.aplicacionVacunaCollection = aplicacionVacunaCollection;
    }

    public TipoVacuna getCodTipovacu() {
        return codTipovacu;
    }

    public void setCodTipovacu(TipoVacuna codTipovacu) {
        this.codTipovacu = codTipovacu;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codVacuna != null ? codVacuna.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vacuna)) {
            return false;
        }
        Vacuna other = (Vacuna) object;
        if ((this.codVacuna == null && other.codVacuna != null) || (this.codVacuna != null && !this.codVacuna.equals(other.codVacuna))) {
            return false;
        }
        return true;
    }
    
}
